<?php
declare(strict_types=1);
namespace App\Controller\Notify;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Service\MessageService\PayNotifyService;
use Hyperf\Di\Annotation\Inject;

/**
 * 支付接口回调
 * @author chenshubo
 * @Controller(prefix="/webapi/notify/pay")
 */
class PayController extends AbstractController
{
    /**
     * @Inject()
     * @var PayNotifyService
     */
    protected $payNotifyService;
    
    /**
     * 回调接口地址
     * @RequestMapping(path="notify/{cid}/{mn_sid}/{mnid}/{payway}/{order_sn}", methods="post")
     */
    public function notify(RequestInterface $request,$cid,$mn_sid,$mnid,$payway,$order_sn)
    {
        return $this->payNotifyService->getPayerNotify(
            (int)$cid,
            (int)$mn_sid,
            (int)$mnid,
            (string)$payway,
            (string)$order_sn,
            $request->getParsedBody()
            );
    }
}